﻿function login()
{
    var name = $('#name').val();
    var pwd = $('#pwd').val();
    var code = $('#code').val();
  
    //alert(name + pwd + code);
    if (name == '') {
       
        alert("用户名不能为空");
       
    }
    else{
        if (pwd == '') {
            alert("密码不能为空");
        }
        else {
            if (code == '') {
                alert("验证码不能为空");
            }
            else {
                //提交到后台
                $.post("../User/dologin", { "name": name, "pwd": pwd, "code": code },
                    function (data) {
                        if (data != "OK") {
                            alert(data);
                            
                        } else {
                            window.location.href = "../Admin/Index";
                        }
                    });
            }
        }
          
    }
    
}

function logout() {
    $.post("../User/LoginOut");
}

